package cn.doitedu.hebust.pre

import org.apache.log4j.{Level, Logger}
import org.apache.spark.SparkConf
import org.apache.spark.sql.SparkSession

object SparkUtil {

  def getSpark(name:String,master:String = "local[*]",confMap:Map[String,String] = Map.empty) : SparkSession = {
    val conf = new SparkConf()
    conf.setAll(confMap)

    val spark = SparkSession.builder()
      .appName(name)
      .master(master)
      .config(conf)
      .getOrCreate()


    spark
  }

}
